<template>
<div class="container">
   <p> {{name}}</p>
    <button @click="upName">change</button>
    </div>  
   
</template>

<script>
import { reactive, toRef } from 'vue';

export default {
name:'App',
setup() {
    //定义响应式数据
    const obj = reactive({
        name:'ls',
        age:18
    }) 
    // const {name}=obj
    const name=toRef(obj,'name')
    console.log(name);
    const upName=()=>{
        name.value='zs'
    }
    return {
        name,
        upName
    }
},
}
</script>

<style>

</style>